package org.netEase.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.netEase.dao.zhutiDao;
import org.netEase.dao.zhutizuDao;
import org.netEase.dao.impl.zhutiDaoImpl;
import org.netEase.dao.impl.zhutizuDaoImpl;
import org.netEase.entity.zhuti;
import org.netEase.entity.zhutizu;

import com.alibaba.fastjson.JSON;
@WebServlet(urlPatterns= {"/backstageManager/selectZhutizu.shtml"})
public class doAjaxzhutizu extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String yid=request.getParameter("yid");
			int yi=0;
			if(yid!=null) {
				yi=Integer.parseInt(yid) ;
			}
		request.setAttribute("yi", yi);
		zhutizuDao zhutizuDao = new zhutizuDaoImpl();
		
		/*request.setAttribute("list", list);
		request.setAttribute("lists", lists);*/
		response.setContentType("application/json;charset=utf-8");
		if(yi != 0) {
			List<zhutizu> lists=zhutizuDao.getID(yi);
			String zhutizu = JSON.toJSONString(lists);
			response.getWriter().write(zhutizu);
		}
	}
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}
}
